// ChatServerCoordiantroDoc.cpp : implementation file
//

#include "stdafx.h"
#include "Chat.h"
#include "ChatServerCoordinatorDoc.h"


// CChatServerCoordiantroDoc

IMPLEMENT_DYNCREATE(CChatServerCoordinatorDoc, CChatBaseDoc)

CChatServerCoordinatorDoc::CChatServerCoordinatorDoc()
: m_pUdpProxyCoordinator(NULL)
{
}

BOOL CChatServerCoordinatorDoc::OnNewDocument()
{
	if (!CChatBaseDoc::OnNewDocument())
		return FALSE;
	
	m_pUdpProxyCoordinator = new RakNet::UDPProxyCoordinator;
	AttachRaknetPlugin(m_pUdpProxyCoordinator);
	m_pUdpProxyCoordinator->SetRemoteLoginPassword(CHAT_SERVER_COORDINATOR_PASSWORD);
	return TRUE;
}

CChatServerCoordinatorDoc::~CChatServerCoordinatorDoc()
{
	if (m_pUdpProxyCoordinator)
	{
		DetachRaknetPlugin(m_pUdpProxyCoordinator);
		delete m_pUdpProxyCoordinator;
		m_pUdpProxyCoordinator = NULL;
	}
}


BEGIN_MESSAGE_MAP(CChatServerCoordinatorDoc, CChatBaseDoc)
END_MESSAGE_MAP()


// CChatServerCoordiantroDoc diagnostics

#ifdef _DEBUG
void CChatServerCoordinatorDoc::AssertValid() const
{
	CChatBaseDoc::AssertValid();
}

#ifndef _WIN32_WCE
void CChatServerCoordinatorDoc::Dump(CDumpContext& dc) const
{
	CChatBaseDoc::Dump(dc);
}
#endif
#endif //_DEBUG

#ifndef _WIN32_WCE
// CChatServerCoordiantroDoc serialization

void CChatServerCoordinatorDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

#endif

// CChatServerCoordiantroDoc commands
